package code.google.model.player.states;

import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import code.google.model.util.interfaces.ISong;

public class PlayingLocalState extends State implements OnCompletionListener{

	public PlayingLocalState(StateManager manager) {
		super(manager);
	}

	@Override
	public boolean pause() {
		player.pause();
		manager.setCurrentState(manager.getPausingLocalState());
		return true;
	}

	@Override
	public boolean seekTo(int position) {
		player.seekTo(position);
		return true;
	}

	@Override
	public boolean play(ISong song) {
		//new song starts
		// destroy everything and reset to startState
		destroyMediaPlayer();
		manager.setCurrentState(manager.getStartState());
		return manager.getStartState().play(song);
		
	}

	@Override
	public void onCompletion(MediaPlayer mp) {
		// feedback for controller needed... save file stuff ... next song stuff
		
	}

}
